home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!escan.demon.co.uk
- From: Bill Birrell <bill@escan.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Two strange C problems.
- Date: Mon, 08 Jan 1996 18:24:00
- Message-ID: <821126182.AA00163@escan.demon.co.uk>
- Reply-To: bill@escan.demon.co.uk
- X-NNTP-Posting-Host: escan.demon.co.uk
- X-Mail2News-Path: escan.demon.co.uk
-
- > PROBLEM 2 :
-
- > const escape=27;
- > const cr=13;
- > const bs=8;
-
- > If I replace the 27 with \27' or the 13 with '\13'
- > then these loops don't
- > work i.e. an infinite loop results. WHY?
-
- That is not really surprising. 27 decimal or escape is '\033' or '\x1b' -
- octal or hexadecimal by default. cr is '\r' or '\015' or '\x0d', nl is '\n' or
- '\012' or '\x0a', bs is '\010' or '\b' or '\x08'. These are all given in the
- reference manual(A.2.5.2). You have just made a mistake, that's all. Nothing important.
- I am told that some compilers allow '\d27' for escape, but I would not bank on
- it.
-
- > Also if I want to do somthing like this : puts("\24
- > \25"); which should
- > print the up and down arrows on the screen (ASCII 24
- > and 25), but no, it
- > prints some other ASCII characters.
-
- Same problem. Do it in octal.
-
- --
- Regards,
- Bill Birrell.
- internet: bill@escan.demon.co.uk
-